﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html style="height:100%" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <meta name="keywords" content="javascript framework, RIA, SPA, client SOA, linb, jsLinb, RAD, IDE, Web IDE, widgets, javascript OOP, opensource, open-source, Ajax, cross-browser, prototype, web2.0, platform-independent, language-independent" />
    <meta name="description" content="Web application created by Visual JS, powered by LINB framework" />
    <meta name="copyright" content="copyright@www.linb.net" />
    <meta http-equiv="imagetoolbar" content="no" />
    <title>Web application powered by LINB framework</title>
</head>
    <body style="height:100%;overflow:hidden;" scroll="no">
        <div id='loading'><img src="../jsontest/runtime/loading.gif" alt="Loading..." /></div>
        <script type="text/javascript" src="../jsontest/runtime/jsLinb/js/linb-all.js"></script>
        <script type="text/javascript">

Class('App', 'linb.Com',{
    Instance:{
        //base Class for this com
        base:["linb.UI"], 
        //requried class for this com
        required:["linb.UI.Button", "linb.DataBinder", "linb.UI.Input"], 

        properties:{}, 
        events:{}, 
        iniResource:function(com, threadid){
        }, 
        iniComponents:function(){
            // [[code created by jsLinb UI Builder
            var host=this, children=[], append=function(child){children.push(child.get(0))};
            
            append((new linb.DataBinder)
                .host(host,"databinder1")
                .setName("dataset")
            );
            
            append((new linb.UI.Button)
                .host(host,"button6")
                .setLeft(180)
                .setTop(120)
                .setCaption("获得数据")
                .onClick("_button6_onclick")
            );
            
            append((new linb.UI.Input)
                .host(host,"input1")
                .setDataBinder("dataset")
                .setDataField("descri")
                .setLeft(180)
                .setTop(40)
            );
            
            append((new linb.UI.Input)
                .host(host,"input2")
                .setDataBinder("dataset")
                .setDataField("product_desc")
                .setLeft(180)
                .setTop(70)
                .setWidth(340)
            );
            
            append((new linb.UI.Button)
                .host(host,"button10")
                .setLeft(320)
                .setTop(120)
                .setCaption("读")
                .onClick("_button10_onclick")
            );
            
            append((new linb.UI.Button)
                .host(host,"button11")
                .setLeft(180)
                .setTop(160)
                .setCaption("更新数据")
                .onClick("_button11_onclick")
            );
            
            return children;
            // ]]code created by jsLinb UI Builder
        }, 
        iniExComs:function(com, hreadid){
        }, 
_button6_onclick:function (profile, e, src, value) {
            var me = this;
            linb.request(
            "http://localhost:8080/jsontest/jspjson.jsp",
            null,
            function(rep, type){
                var ss = _.str.ltrim(rep);
                ss = _.str.rtrim(ss);
                var obj = _.unserialize(ss);
                alert(ss);
                me.databinder1.resetValue(obj);
            });
}, 
        _button10_onclick:function (profile, e, src, value) {
            me = this;
            alert(_.serialize(this.databinder1.getValue()))
        }, 
        _button11_onclick:function (profile, e, src, value) {
            var me = this;
            var newobj = _.serialize(me.databinder1.getValue());
            linb.request(
            "http://localhost:8080/jsontest/upjson.jsp",
            "dv="+newobj,
            function(rep){
                var ss = _.str.ltrim(rep);
                var obj = _.unserialize(ss);
				if (obj.hascommit == 'true') {
					alert('true');
                	document.location = "checkuser.jsp";
                }
                
            });
        }
    }
});

//linb.setAppLangKey('app');
linb.UI.setTheme('default');
linb.Com.load('App', function(){linb('loading').remove()}, 'cn');
        </script>
</body>
</html>